﻿CREATE PROCEDURE [dbo].[proc_GetCustomerItem_Tel]
	(
		@Tel nvarchar(50)
	)
AS
	Select
	Id,
	CustomerId,
	CustomerName,
	Project,
	Webaddress,
	Tel,
	Fax,
	Address,
	Zip,
	IndustryOneId,
	IndustryTwoId,
	SourceId,
	StateId,
	TypeId,
	CreateDate,
	CreateDate,
	CreateName,
	isnull(ProtectDate,'') as ProtectDate,
	isnull(ProtectName,'') as ProtectName,
	isnull((Select Title From Customer_Industry Where Id=Customer.IndustryOneId),'...') As IndustryOne,
	isnull((Select Title From Customer_Industry Where Id=Customer.IndustryTwoId),'...') As IndustryTwo,
	(Select Title From Customer_Source Where Id=Customer.SourceId) As Source,
	(Select Title From Customer_State Where Id=Customer.StateId) As State,
	(Select Title From Customer_Type Where Id=Customer.TypeId) As Type,
	ProtectId,
	(Select Title From Customer_Protect Where Id=Customer.ProtectId) As Protect,
	CompanyId,
	(Select CompanyName From Company Where Id=Customer.CompanyId) As Company,
	Pid,
	(Select Title From Province Where Id=Customer.pid) As Province,
	Cid,
	(Select Title From City Where Id=Customer.cid) As City,
	IsNull(Intentionsid,'0') as Intentionsid,
	PublicityDemandId,
	NetworkConsciousnessId
	From Customer Where Tel=@Tel
	RETURN
